package com.example.mapper;

import com.example.pojo.Indent;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface IndentMapper {
    @Insert("insert into indent(name, area, room_type, price, image, mm, s_date, y, z_date, zfprice, tname, fname, id_u, id_a,id_f,fimage,timage, fnickname,znickname,tnumber, fnumber, fid_card, zid_card) values (#{name}, #{area},#{roomType}, #{price}, #{image}, #{mm}, #{sDate}, #{y}, #{zDate}, #{zfprice}, #{tname}, #{fname}, #{idU},#{idA},#{idF}, #{fimage},#{timage},#{fnickname} ,#{znickname},#{tnumber}, #{fnumber}, #{fidCard}, #{zidCard}) ")
    void addOrder(Indent indent);

    List<Indent> getOrder(String name, LocalDateTime date, Integer idU);

    @Delete("delete from indent where id=#{id} and id_u=#{idU}")
    void delOrder(Integer id, Integer idU);

    @Select("select id from indent where sfdq=0 and z_date < #{now}")
    List<Integer> getDq(LocalDateTime now);

    @Select("select id_a from indent where sfdq=0 and z_date < #{now}")
    List<Integer> getDqA(LocalDateTime now);

    void setDq(List<Integer> ids);
}
